#include <bits/stdc++.h>
using namespace std;

struct CompareMap {
    bool operator()(const int& a, const int& b) const {
        return a > b;
    }
};

int main() {
    auto compare = [&](int a, int b) {return abs(a) < abs(b);};
    priority_queue<int, vector<int>, decltype(compare)> pq(compare);
    pq.push(-1);
    pq.push(-5);
    pq.push(100);
    pq.push(200);
    std::cout << "Elements in custom priority queue: ";
    while (!pq.empty()) {
        std::cout << pq.top() << " ";
        pq.pop();
    }
    cout << endl;
    // map接受的是int类型的比较
    auto comparemap = [&](int a, int b) {return a > b;};
    map<int, int, decltype(comparemap)> m(comparemap);
    m[1] = 3;
    m[-1] = 10;
    m[-2] = 120;
    m[-3] = 20;
    for(auto a : m) {
        cout << a.first << " "; // 1 -1 -2 -3
    }
    
}